#ifndef __ONLINE_READER_SYSTEM_H__
#define __ONLINE_READER_SYSTEM_H__

// Design points:
// 1. It has books, system can add, remove, and search books;
// 2. It has users, system can create, remove, and search users;
// 3. Users can search books, add, remove books from his booklist;
// 4. Users can resume from the point where he stopped;
// 5. System can list the books in the user's book list;
// 6. Different users can reserver different number of books

class Book {
public:
    Book(char *name);
    ~Book();

    char *getName();
    unsigned int getPageNum();
    unsigned int getBookID();

private:
    char name_[256];
    unsigned int id_;
    unsigned int page_num_;

    void *book_;
};

struct BOOK_INFO {
    Book *book;
    INFO info;
};

class BookTracker {
public:
    BookTracker();
    ~BookTracker();

    void AddBook(Book *book);
    bool RemoveBook(char *name);
    Book *SearchBook(char *name);

    void ListAllBooks();

    unsigned int resumeFromLastTime(char *name);

private:

    BOOK_INFO *book_list_;
};


class User {
public:
    User(char *name);
    ~User();

    char *getName();
    unsigned int getID();
    unsigned int getCredit();

private:
    char name_[256];
    unsigned int id_;
    unsigned int credit_;
    unsigned int max_book_num_;

    UserBookTracker *book_tracker_;
};

class Library {
public:
    Library();
    ~Library();

    void AddBook(Book *book);
    void removeBook(char *name);
    Book *searchBook(char *name);

private:
    Book *book_list_;
};

class UserDataBase() {
public:
    UserDataBase();
    ~UserDataBase();

    bool createUser(char *name);
    bool deleteUser(char *name);

    char *getUserInfo(char *name);

private:
    User *user_list_;
};

class ReaderSystem {
public:
    void addUser(char *name);
    void removeUser(char *name);
    Bool *SearchBook(char *name);

private:
    UserDataBase user_db_;
    Library library_;
};

#endif

